import { uniqueId } from "lodash";

export default {
  namespaced: true,
  state: {
    currentItemArr: [],
    currentDialogItemArr: [],
    currentItemId: "",
    currentObj: {},
    // 当先选中区块的type
    currentActiveType: "group",
    // 父级容器
    currentParentItem: "",
    // 右侧tab的当前选中项
    activeName: "field",
    savedItemArr: "",
    // 表单类型 0=>事项表单,1=>统一字段
    formType: 0,
    // 弹窗的表单配置
    currentPopupItemArr: [],
  },
  actions: {},
  mutations: {
    setCurrentItemArr(state, currentItemArr) {
      state.currentItemArr = currentItemArr;
    },
    setCurrentPopupItemArr(state, currentPopupItemArr) {
      state.currentPopupItemArr = currentPopupItemArr;
    },
    setCurrentDialogItemArr(state, currentDialogItemArr) {
      state.currentDialogItemArr = currentDialogItemArr;
    },
    setCurrentItemId(state, currentItemId) {
      state.currentItemId = currentItemId;
    },
    setCurrentObj(state, currentObj) {
      state.currentObj = currentObj;
    },
    setCurrentActiveType(state, currentActiveType) {
      state.currentActiveType = currentActiveType;
    },
    setCurrentParentItem(state, currentParentItem) {
      state.currentParentItem = currentParentItem;
    },
    setActiveName(state) {
      state.activeName = uniqueId();
    },
    setFormType(state, formType) {
      state.formType = formType;
    },
  },
};
